import axios from 'axios';


const ajax = axios.create({
    
    headers: {
        'Content-Type': 'multipart/form-data',
        'consoleToken': localStorage.getItem('adminToken')
    },
    timeout: 40000
});

export function upload (url, formData, config) {
    return new Promise((resolve, reject) => {
        ajax.post(
            url,
            data,
            dataType === JSON_TYPE ? JSON_CONFIG : ''
        ).then(res => {
            if (res.code === '000') {
                resolve(res);
            } else {
                // 具体调用的地方catch处理
                reject(res);
            }
        }).catch(error => {
            // iView.Message.error(error.message);
            reject(error);
        });
    });
};
